import React, { FC, createElement } from 'react';
import { BaseWrapper } from '../base';
import { BaseFieldSelect } from '../select/base-field-select';
import { useFormContainerSelector } from '../../form-container';

export interface FieldSelectGroupProps {
  max: string;
}

export const FieldSelectGroup: FC<FieldSelectGroupProps> = (props) => {
  const [readonly] = useFormContainerSelector((s) => [s.readonly]);
  const { columnConfig } = props;
  return (
    <BaseWrapper {...props}>
      <BaseFieldSelect
        selectProps={{ mode: 'multiple' }}
        {...props}
        innerProps={{
          disabled: readonly || columnConfig?.status === '2',
        }}
      />
    </BaseWrapper>
  );
};
